Skip to content

Conversation

ttw225
Copy link
Contributor

@ttw225 ttw225 commented Oct 9, 2025

Fix tab-completion suggesting names that are not accessible on instances
(e.g., Enum members showing __name__).

Change

In rlcompleter.attr_matches(), when getattr(thisobject, word, None)
is None, only add the candidate if hasattr(thisobject, word) is true.

Effect

Removes bogus suggestions without affecting valid completions.

Bogus suggestions

['Color.BLUE.__iter__',
 'Color.BLUE.__getitem__',
 'Color.BLUE.__members__',
 'Color.BLUE.__contains__',
 'Color.BLUE.__qualname__',
 'Color.BLUE.__len__',
 'Color.BLUE.__name__']
# Additionally seen among bogus suggestions:
'Enum.__abstractmethods__'

@ttw225
Copy link
Contributor Author

ttw225 commented Oct 9, 2025

Noted the CI Test failure. I’m working on a fix and will push soon.

@ttw225
Copy link
Contributor Author

ttw225 commented Oct 9, 2025

Tests have passed. Thanks for reviewing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant